package com.mate.cloud.message.task;

import com.mate.cloud.message.constants.PhoneConstants;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 * 设置定时任务，每天0点清除所有短信获取次数
 * @author:         MI
 * @email:          448341911@qq.com
 * @createTime:     2024/5/24 16:48
 * @updateUser:     MI
 * @updateTime:     2024/5/24 16:48
 * @updateRemark:   修改内容
 * @version:        v1.0
 */
@Configuration
public class TaskConfig {

    @Resource
    private RedisTemplate redisTemplate;

    @Scheduled(cron = "10 18 * * * ?")
    public void clearPhoneCount(){
        System.out.println("-----------------");
        redisTemplate.delete(redisTemplate.keys(PhoneConstants.REX_COUNT_SUFFIX));
    }

}
